package com.yuyu.service.impl;

import com.yuyu.bean.Product;
import com.yuyu.mapper.ProductMapper;
import com.yuyu.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service("productService")
@Transactional
public class ProductServiceImpl implements ProductService {
    @Autowired
    private ProductMapper productMapper;

    @Override
    public Product findProductByBarCode(String code) {
        return productMapper.findProductByBarCode(code);
    }

    @Override
    public List<Product> findProductByName(String name) {
        return productMapper.findProductByName(name);
    }

    @Override
    public List<Product> findProductByClassifyName(String name) {
        return productMapper.findProductByClassifyName(name);
    }

    @Override
    public int addProduct(Product product) {
        return productMapper.addProduct(product);
    }

//    @Override
//    public int deleteProductByBarCode(String code) {
//        return productMapper.deleteProductByBarCode(code);
//    }

    @Override
    public List<Product> findAllProduct() {
        return productMapper.findAllProduct();
    }

    @Override
    public Product findProductById(Integer id) {
        return productMapper.findProductById(id);
    }

    @Override
    public int editProduct(Product product) {
        return productMapper.editProduct(product);
    }

    @Override
    public int deleteProduct(List<Integer> list) {
        return productMapper.deleteProduct(list);
    }

}
